<?php

/**
 * SocialEngine
 *
 * @category   Application_Extensions
 * @package    Sitealbum
 * @copyright  Copyright 2010-2011 BigStep Technologies Pvt. Ltd.
 * @license    http://www.socialengineaddons.com/license/
 * @version    $Id: featured-photos-carousel.tpl 2011-08-026 9:40:21Z SocialEngineAddOns $
 * @author     SocialEngineAddOns
 */
?>
<?php
$photoSettings=  array();
$photoSettings['class'] = 'thumb';

?>
<?php if ($this->direction == 1) { ?>
 <?php  $j=0; $offset=$this->offset; ?>

    <?php foreach ($this->featuredPhotos as $photo): ?>
      <?php if($j% $this->itemsVisible ==0):?>
        <div class="Sitealbum_SlideItMoo_element" style="width:<?php echo 146 * $this->inOneRow; ?>px;">
        <div class="Sitealbum_SlideItMoo_PhotoList">
      <?php endif;?>
      <div class="featured_thumb_photo">
        <a href="<?php echo $photo->getHref() ?>"  <?php if ($this->showLightBox): ?> onclick='openLightBoxAlbum("<?php echo $photo->getPhotoUrl() ?>","<?php echo Engine_Api::_()->sitealbum()->getLightBoxPhotoHref($photo, array_merge($this->params, array('offset'=>$offset))) ?>");return false;' <?php endif; ?> title="<?php echo $photo->title; ?>" class="thumb_img">
        	<span style="background-image: url(<?php echo $photo->getPhotoUrl('thumb.normal'); ?>);"></span>
        </a>
				<span class="show_photo_des">
      		<?php
          $owner = $photo->getOwner();
          $parent = $photo->getParent();
          echo $this->translate('By %1$s in %2$s.',
                $this->htmlLink($owner->getHref(), $this->string()->truncate($owner->getTitle(),25)),
                $this->htmlLink($parent->getHref(), $this->string()->truncate($parent->getTitle(),25)));
          ?>
      	</span>
      </div>
        <?php $j++; $offset++;?>
       <?php if(($j% $this->itemsVisible) ==0):?>
           </div>
        </div>    
       <?php endif;?>     
    <?php endforeach; ?>
    <?php if($j <($this->totalItemsInSlide)):?>
       <?php for ($j;$j<($this->totalItemsInSlide); $j++ ): ?>
      <div class="featured_thumb_photo">
      </div>
       <?php endfor; ?>
         </div>
      </div>
    <?php endif;?>
     
<?php } else {?>
<?php $count=$this->itemsVisible;
$j=0;  $offset=$this->offset+$count;?>
  <?php for ($i =$count; $i < $this->totalItemsInSlide; $i++):?>
      <?php if ($j % $this->itemsVisible == 0): ?>
      <div class="Sitealbum_SlideItMoo_element" style="width:<?php echo 146 * $this->inOneRow; ?>px;">
        <div class="Sitealbum_SlideItMoo_PhotoList">
      <?php endif; ?>
          <?php if ($i < $this->count): ?>
            <div class="featured_thumb_photo">
              <a href="<?php echo $this->featuredPhotos[$i]->getHref() ?>"  <?php if ($this->showLightBox): ?> onclick='openLightBoxAlbum("<?php echo $this->featuredPhotos[$i]->getPhotoUrl() ?>","<?php echo Engine_Api::_()->sitealbum()->getLightBoxPhotoHref($this->featuredPhotos[$i], array_merge($this->params, array('offset'=>$offset))) ?>");return false;' <?php endif; ?> title="<?php echo $this->featuredPhotos[$i]->title; ?>" class="thumb_img">
              	<span style="background-image: url(<?php echo $this->featuredPhotos[$i]->getPhotoUrl('thumb.normal'); ?>);"></span>
             	</a>
							<span class="show_photo_des">
            		<?php
                $owner = $this->featuredPhotos[$i]->getOwner();
                $parent = $this->featuredPhotos[$i]->getParent();
                echo $this->translate('By %1$s in %2$s.',
                     $this->htmlLink($owner->getHref(), $this->string()->truncate($owner->getTitle(),25)),
                     $this->htmlLink($parent->getHref(), $this->string()->truncate($parent->getTitle(),25)));
                ?>
            	</span>
             </div>
          <?php else: ?>
             <div class="featured_thumb_photo">
             </div>
          <?php endif; ?>
      <?php $j++; $offset++;?>
      <?php if (($j % $this->itemsVisible) == 0): ?>
          </div>
        </div>
      <?php endif; ?>     
     
  <?php endfor;?>
 <?php $j=0; $offset=$this->offset; ?>
 <?php for ($i = 0; $i < $count; $i++): ?>
   <?php if ($j % $this->itemsVisible == 0): ?>
      <div class="Sitealbum_SlideItMoo_element" style="width:<?php echo 146 * $this->inOneRow; ?>px;">
        <div class="Sitealbum_SlideItMoo_PhotoList">
      <?php endif; ?>        
            <div class="featured_thumb_photo">
	            <a href="<?php echo $this->featuredPhotos[$i]->getHref() ?>"  <?php if ($this->showLightBox): ?> onclick='openLightBoxAlbum("<?php echo $this->featuredPhotos[$i]->getPhotoUrl() ?>","<?php echo Engine_Api::_()->sitealbum()->getLightBoxPhotoHref($this->featuredPhotos[$i], array_merge($this->params, array('offset'=>$offset))) ?>");return false;' <?php endif; ?> title="<?php echo $this->featuredPhotos[$i]->title; ?>" class="thumb_img">
	            		<span style="background-image: url(<?php echo $this->featuredPhotos[$i]->getPhotoUrl('thumb.normal'); ?>);"></span>
	            </a>
							<span class="show_photo_des">
            		<?php
                $owner = $this->featuredPhotos[$i]->getOwner();
                $parent = $this->featuredPhotos[$i]->getParent();
                echo $this->translate('By %1$s in %2$s.',
                     $this->htmlLink($owner->getHref(), $this->string()->truncate($owner->getTitle(),25)),
                     $this->htmlLink($parent->getHref(), $this->string()->truncate($parent->getTitle(),25)));
                ?>
            	</span>
	          </div>
         <?php $j++; $offset++; ?>
        <?php if ($j % $this->itemsVisible == 0): ?>
          </div>
        </div>
      <?php endif; ?>
  <?php endfor; ?>
 <?php } ?>
